package com.itheima;

import com.itheima.properties.*;
import com.itheima.template.*;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

@EnableConfigurationProperties(
        {SmsProperties.class, OssProperties.class, FaceCheckProperties.class, HuanXinProperties.class, GreenProperties.class}
)
public class TanhuaAutoConfigurationConfig {
    @Bean
    public SmsTemplate smsProperties(SmsProperties smsProperties){
        return new SmsTemplate(smsProperties);
    }

    @Bean
    public OssTemplate ossTemplate(OssProperties ossProperties){
        return new OssTemplate(ossProperties);
    }

    @Bean
    public FaceCheckTemplate faceCheckTemplate(FaceCheckProperties faceCheckProperties){
        return new FaceCheckTemplate(faceCheckProperties);
    }

    @Bean
    public HuanXinTemplate huanXinTemplate(HuanXinProperties huanXinProperties){
        return new HuanXinTemplate(huanXinProperties);
    }

    @Bean
    @ConditionalOnProperty(prefix = "tanhua.green",value = "enable", havingValue = "true")
    public AliyunGreenTemplate aliyunGreenTemplate(GreenProperties greenProperties){
        return new AliyunGreenTemplate(greenProperties);
    }
}
